package com.shrct.businessprocess.budget

import org.springframework.stereotype.Service
import com.shrct.businessprocess.budget.impl.*
import com.shrct.businessprocess.purchase.impl.*
import edu.fudan.mylang.pf.IObjectFactory
import org.springframework.beans.factory.annotation.Autowired
import edu.fudan.langlab.domain.code.*
import com.shrct.businessprocess.product.RCBrand

@Service("CommonBudgetTypeRegister")
class BudgetTypeRegister implements BudgetTypeProvider{
	@Autowired
	private IObjectFactory objectFactory
	private CodeService codeService
	override getRegisteredBudgetTypes() {
		
		newArrayList(
			new BudgetType("RCAXBudget",RCBudgetCategory::PartA,"设备产品(及关联维保)",false),
			new BudgetType("RCCompanyQualityServiceBudget",RCBudgetCategory::PartA,"公司质保",true)[project|
				RCCompanyQualityServiceBudgetImpl::create(project.cbd,objectFactory)=>[
					it.productCategory = objectFactory.all(typeof(RCBrand)).findFirst[it.codeid.equals("X01")]
					it.serviceContractPrice = project.zeroAmount
					it.serviceContractTaxRate = 0d
					it.serviceNetPrice = project.zeroAmount
					it.serviceNetTaxRate = 0d
					it.productContractPrice = project.zeroAmount
					it.productContractTaxRate = 0d
					it.productNetPrice = project.zeroAmount
					it.productNetTaxRate = 0d
				]
			],
			new BudgetType("RCAZBudget",RCBudgetCategory::PartA,"耗材",true)[project|
				RCAnonymousProductPurchaseBudgetImpl::create(project.cbd,objectFactory)=>[
					it.netPrice = project.getZeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCC1Budget",RCBudgetCategory::PartB,"设备续保",false),
			new BudgetType("RCAYBudget",RCBudgetCategory::PartD,"其他产品与服务",false),
			new BudgetType("RCB1Budget",RCBudgetCategory::PartC,"运保费 、进口代理费",true)[project|
				RCB1BudgetImpl::create(project.cbd,objectFactory)=>[
					it.netPrice = project.getZeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCB2Budget",RCBudgetCategory::PartC,"银行费用",true)[project|
				RCB2BudgetImpl::create(project.cbd,objectFactory)=>[
					it.netPrice = project.getZeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCC3Budget",RCBudgetCategory::PartD,"公司工程师服务",true)[project|
				RCC3BudgetImpl::create(project.cbd,objectFactory)=>[
					it.contractPrice = project.zeroAmount
					it.contractTaxRate = 0d
					it.netPrice = project.zeroAmount
					it.netTaxRate = 0d
					it.type = RCC3BudgetType::P0
				]
			],
			new BudgetType("RCAYBudget",RCBudgetCategory::PartD,"第三方外包服务",true)[project|
				RCNormalProductPurchaseBudgetImpl::create(project.cbd,objectFactory)=>[
					it.name = "第三方外包服务"
					it.contractPrice = project.zeroAmount
					it.contractTaxRate = 0d
					it.netPrice = project.zeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCAYBudget",RCBudgetCategory::PartD,"培训",true)[project|
				RCNormalProductPurchaseBudgetImpl::create(project.cbd,objectFactory)=>[
					it.name = "培训费"
					it.contractPrice = project.zeroAmount
					it.contractTaxRate = 0d
					it.netPrice = project.zeroAmount
					it.netTaxRate = 0d
				]
			],
//			new BudgetType("RCC6Budget",RCBudgetCategory::PartC,"其他服务费",false),
			new BudgetType("RCEX1Budget",RCBudgetCategory::PartE,"市场费1",true)[project|
				RCEX1BudgetImpl::create(project.cbd,objectFactory)=>[
					it.name = "市场费1"
					it.netPrice = project.zeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCEX2Budget",RCBudgetCategory::PartE,"市场费2",true)[project|
				RCEX2BudgetImpl::create(project.cbd,objectFactory)=>[
					it.name = "市场费2"
					it.netPrice = project.zeroAmount
					it.netTaxRate = 0d
				]
			],
			new BudgetType("RCEX2ExtBudget",RCBudgetCategory::PartE,"附加费",true)[project|
				RCEX2ExtBudgetImpl::create(project.cbd,objectFactory)
			],
			new BudgetType("RCF1Budget",RCBudgetCategory::PartF,"销售发票税",true)[project|
				RCF1BudgetImpl::create(project.cbd,objectFactory)
			],
			new BudgetType("RCF2Budget",RCBudgetCategory::PartF,"销售附加税",true)[project|
				RCF2BudgetImpl::create(project.cbd,objectFactory)
			]
			//RCF1Budget
		)
	}
	
}